package tw.edu.tku.im.maze;

import org.json.JSONException;
import org.json.JSONObject;

import android.os.Parcel;
import android.os.Parcelable;

public class EndGameRep extends RepPacket {
   GameState gameState;
   
   public EndGameRep(int exp) {
      this.gameState = new GameState(true, true, exp);
   }
   
   public EndGameRep(GameState gameState) {
      this.gameState = gameState;
   }
   
   public GameState getGameState() {
      return gameState;
   }

   public void setGameState(GameState gameState) {
      this.gameState = gameState;
   }

   @Override
   public String toJSONString() throws JSONException {
      JSONObject jsonObj = new JSONObject();
      jsonObj.put("result", new JSONObject(this.gameState.toJSONString()));
      jsonObj.put("action", "endGameResponse");
      return jsonObj.toString();
   }

   @Override
   public String getPacketName() {
      return "endGameResponse";
   }

   @Override
   public int describeContents() {
      return 0;
   }

   @Override
   public void writeToParcel(Parcel arg0, int arg1) {
      
   }
}
